package com.sk.skplanet.commute.views;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;

import com.sk.skplanet.commute.R;
import com.sk.skplanet.commute.actions.Actions;
import com.sk.skplanet.commute.controllers.DialogController;
import com.sk.skplanet.commute.controllers.RouteController;
import com.sk.skplanet.commute.vo.Data;
import com.sk.skplanet.commute.vo.Member;

public class RouteList extends Activity {

	LinearLayout layout_locationlist;
	Button button_routelist_addroute;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.routelist);

		layout_locationlist = (LinearLayout) findViewById(R.id.layout_locationlist);
		button_routelist_addroute = (Button) findViewById(R.id.button_routelist_addroute);
		Data.routeContext = this;

		button_routelist_addroute.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				DialogController.createRouteDialog(RouteList.this).show();
			}
		});

		if (Data.memberData != null) {
			for (int routePostion = 0; routePostion < Data.memberData.getRoutes().size(); routePostion++) {
				layout_locationlist.addView(RouteController.makeRoute(this, routePostion));
				// Log.i("루트리스트 접근", Data.memberData.getRoutes().get(routePostion).toString());
			}
		}

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
